import agconnect from '@hw-agconnect/api'
import '@hw-agconnect/auth'
import '@hw-agconnect/instance'
import '@hw-agconnect/database'
import { AGConnectCloudDB } from '@hw-agconnect/database'

const agConnectConfig = {
  agcgw: {
    url: 'connect-drcn.dbankcloud.cn',
    backurl: 'connect-drcn.hispace.hicloud.com',
    websocketurl: 'connect-ws-drcn.hispace.dbankcloud.cn',
    websocketbackurl: 'connect-ws-drcn.hispace.dbankcloud.com',
  },
  agcgw_all: {
    SG: 'connect-dra.dbankcloud.cn',
    SG_back: 'connect-dra.hispace.hicloud.com',
    CN: 'connect-drcn.dbankcloud.cn',
    CN_back: 'connect-drcn.hispace.hicloud.com',
    RU: 'connect-drru.hispace.dbankcloud.ru',
    RU_back: 'connect-drru.hispace.dbankcloud.cn',
    DE: 'connect-dre.dbankcloud.cn',
    DE_back: 'connect-dre.hispace.hicloud.com',
  },
  websocketgw_all: {
    SG: 'connect-ws-dra.hispace.dbankcloud.cn',
    SG_back: 'connect-ws-dra.hispace.dbankcloud.com',
    CN: 'connect-ws-drcn.hispace.dbankcloud.cn',
    CN_back: 'connect-ws-drcn.hispace.dbankcloud.com',
    RU: 'connect-ws-drru.hispace.dbankcloud.ru',
    RU_back: 'connect-ws-drru.hispace.dbankcloud.cn',
    DE: 'connect-ws-dre.hispace.dbankcloud.cn',
    DE_back: 'connect-ws-dre.hispace.dbankcloud.com',
  },
  client: {
    cp_id: '2850086000411044427',
    product_id: '461323198429470087',
    client_id: '1603824504470001344',
    client_secret: '8952AC8BC3C6C787BE93708CEB39DB373D165850DA035EDAE237FEE972A194BF',
    project_id: '461323198429470087',
    app_id: '245150415728161361',
    api_key:
      'DQEDAI4AlVzuOrozt69+oba7m6mtVIJmAuE379FYZqW/USzglpzwi6FMLAbjMQh6uLyZSS/skqgSerSdINJRAcNvXRvvpVX6Q109aA==',
  },
  oauth_client: { client_id: '113305137', client_type: 7 },
  app_info: { app_id: '245150415728161361' },
  service: {
    analytics: {
      collector_url: 'datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn',
      collector_url_cn: 'datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn',
      collector_url_de: 'datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn',
      collector_url_ru: 'datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com',
      collector_url_sg: 'datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn',
      resource_id: 'p1',
      channel_id: '',
    },
    ml: { mlservice_url: 'ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn' },
    cloudstorage: {
      storage_url: 'https://agc-storage-drcn.platform.dbankcloud.cn',
      storage_url_ru: 'https://agc-storage-drru.cloud.huawei.ru',
      storage_url_sg: 'https://ops-dra.agcstorage.link',
      storage_url_de: 'https://ops-dre.agcstorage.link',
      storage_url_cn: 'https://agc-storage-drcn.platform.dbankcloud.cn',
      storage_url_ru_back: 'https://agc-storage-drru.cloud.huawei.ru',
      storage_url_sg_back: 'https://agc-storage-dra.cloud.huawei.asia',
      storage_url_de_back: 'https://agc-storage-dre.cloud.huawei.eu',
      storage_url_cn_back: 'https://agc-storage-drcn.cloud.huawei.com.cn',
      default_storage: 'web-kl4jb',
    },
    search: { url: 'https://search-drcn.cloud.huawei.com' },
    edukit: { edu_url: 'edukit.cloud.huawei.com.cn', dh_url: 'edukit.cloud.huawei.com.cn' },
  },
  region: 'CN',
  configuration_version: '3.0',
}

export const configInstance = () => {
  // 初始化AGC
  agconnect.instance().configInstance(agConnectConfig)
  // 初始化对应数据处理位置的AGConnectCloudDB
  AGConnectCloudDB.initialize(agConnectConfig)
}
